function fn3() {
  function execWithTimeout(fn, ms) {
    return new Promise((resolve, reject) => {
      let timer = setTimeout(() => {
        reject("已超时");
      }, ms);

      fn1().then((ret) => {
        clearTimeout(timer);
        resolve(ret);
      });
    });
  }

  function fn1() {
    return new Promise((resolve) =>
      setTimeout(() => {
        resolve("淘宝的页面");
      }, 1000)
    );
  }

  execWithTimeout(fn1, 2000)
    .then((ret) => console.log("ret=", ret))
    .catch((err) => console.error("err=", err));
}
